package com.itheima.Demo01.demo01;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class TestPoolDemo01 {
    public static void main(String[] args) {
        ThreadPoolExecutor pool = new ThreadPoolExecutor(
                4,
                5,
                1,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(2),
                Executors.defaultThreadFactory(),
                new ThreadPoolExecutor.AbortPolicy());
        pool.submit(new MyRunnble());
        pool.submit(new MyRunnble());
        pool.submit(new MyRunnble());
        pool.submit(new MyRunnble());
        pool.submit(new MyRunnble());
        pool.submit(new MyRunnble());
        pool.submit(new MyRunnble());
//        pool.submit(new MyRunnble());
//        pool.submit(new MyRunnble());
//        pool.submit(new MyRunnble());
//        pool.submit(new MyRunnble());
//        pool.submit(new MyRunnble());
//        pool.submit(new MyRunnble());
//        pool.submit(new MyRunnble());


        pool.shutdown();
    }
}
